/*
 * MIT License
 *
 * Copyright (c) 2023 北京凯特伟业科技有限公司
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.je.common.base.office.vo;

import com.je.common.base.DynaBean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class OfficeDataVo {
    /**
     * 数据源名称
     */
    private String name;
    /**
     * 数据源编码
     */
    private String code;
    /**
     * 类型   单条  多条
     */
    private String type;
    /**
     * 文档数据源关联
     */
    private DynaBean docDs=new DynaBean();
    /**
     * 数据源Bean
     */
    private DynaBean dsBean=new DynaBean();
    /**
     * 数据字段
     */
    private List<DynaBean> fields=new ArrayList<>();
    /**
     * 数据字段集合
     */
    private Map<String, DynaBean> fieldInfos=new HashMap<>();
    /**
     * 单条数据
     */
    private DynaBean dynaBean=new DynaBean();
    /**
     * 多条数据
     */
    private List<DynaBean> lists=new ArrayList<>();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public DynaBean getDsBean() {
        return dsBean;
    }

    public void setDsBean(DynaBean dsBean) {
        this.dsBean = dsBean;
    }

    public List<DynaBean> getFields() {
        return fields;
    }

    public void setFields(List<DynaBean> fields) {
        for(DynaBean field:fields){
            fieldInfos.put(field.getStr("FIELD_CODE"),field);
        }
        this.fields = fields;
    }
    public DynaBean getField(String code){
        return fieldInfos.get(code);
    }
    public DynaBean getDynaBean() {
        return dynaBean;
    }

    public void setDynaBean(DynaBean dynaBean) {
        this.dynaBean = dynaBean;
    }

    public List<DynaBean> getLists() {
        return lists;
    }

    public void setLists(List<DynaBean> lists) {
        this.lists = lists;
    }

    public DynaBean getDocDs() {
        return docDs;
    }

    public void setDocDs(DynaBean docDs) {
        this.docDs = docDs;
    }
}
